package hw2.cs236369.tests;

import static org.junit.Assert.*;

import hw2.cs236369.interfaces.IAuthor;
import hw2.cs236369.parsing.Author;
import hw2.cs236369.parsing.Paper;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;


public class PaperTest {
	private static Paper	p;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		ArrayList<IAuthor> l = new ArrayList<IAuthor>();
		l.add(new Author("A"));
		l.add(new Author("B"));
		l.add(new Author("C"));
		l.add(new Author("D"));
		p = new Paper(2012, l);
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetAuthors() {
		ArrayList<IAuthor> expected = new ArrayList<IAuthor>(Arrays.asList(new Author("A"), new Author("B"), new Author("C"), new Author("D")));
		Collection<IAuthor> l = p.getAuthors();
		assertEquals(4, l.size());
		assertEquals(expected, l);
	}

	@Test
	public void testGetPublicationYear() {
		assertEquals(2012, p.getPublicationYear());
	}


}
